触发器 Trigger2-new
检测碰撞发生的方式有两种,
一种是利用碰撞体,
private void OnCollisionEnter(Collision collision){
print("OncollisionEnter");
Destroy(gameObject);
}
另一种则是利用触发器
private void OnTriggerEnter(Collider other){
Destroy(gameObject);
}
![[Pasted image 20220922154834.png]]![[Pasted image 20220922154834.png]](assets/Pasted image 20220922154834.png)